package com.phiture.erp.purchase.dal.entity;

import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;

import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * ERP 采购订单项 DO
 */
@TableName("erp_purchase_order_items")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ErpPurchaseOrderItemDO extends BaseDO {

    /**
     * 编号
     */
    @TableId
    private Long id;
    /**
     * 采购订单编号
     *
     * 关联 {@link ErpPurchaseOrderDO#getId()}
     */
    private Long orderId;
    /**
     * 物料编号
     *
     */
    private Long materialId;
    /**
     * 物料单位单位
     *
     */
    private Long materialUnitId;

    /**
     * 物料单位单价，单位：元
     */
    private BigDecimal materialPrice;
    /**
     * 数量
     */
    private BigDecimal count;
    /**
     * 总价，单位：元
     *
     * totalPrice = materialPrice * count
     */
    private BigDecimal totalPrice;
    /**
     * 税率，百分比
     */
    private BigDecimal taxPercent;
    /**
     * 税额，单位：元
     *
     * taxPrice = totalPrice * taxPercent
     */
    private BigDecimal taxPrice;

    /**
     * 交货日期
     */
    private LocalDate deliveryDate;

    /**
     * 备注
     */
    private String remark;

    /**
     * 销售订单ID
     */
    private Long saleOrderId;
    /***
     * 销售订单号
     */
    private String saleOrderNo;
    /**
     * 销售订单明细ID
     */
    private Long saleOrderItemId;

    // ========== 采购入库 ==========
    /**
     * 采购入库数量
     */
    private BigDecimal inCount;

    // ========== 采购退货（出库）） ==========
    /**
     * 采购退货数量
     */
    private BigDecimal returnCount;

    private Long sourceBillId;

    private Long sourceBillDetailId;



}